/**
 * @typedef {{
 *   message?: string;
 * }} FormRule
 *
 * @typedef {{
 *   name: string;
 *   required: boolean;
 *   rules?: FormRule[];
 * }} FormItem
 */

/**
 *
 * @param config {FormItem}
 */
export function genRules(config) {
  const { name = "", required } = config;
  const resultRules = [];
  if (required) {
    resultRules.push({
      required: true,
      message: `请输入${name}`,
    });
  }
  return resultRules;
}
